#include <bits/stdc++.h>
using namespace std;
#define clr(a) memset(a, 0, sizeof a)
const int MN = 11000, MT = 1e6+10, MS = 150+5;
int tr[MN][26], cnt[MS], val[MN], last[MN], f[MN], sz;
char P[MS][70+10];

map<string, int> sid;

void add(char *s, int id){
    int p = 0;
    for (int i = 0; i < strlen(s); ++i) {
        int& nx = tr[p][s[i]-'a'];
        if(!nx) {
            ++sz;
            clr(tr[sz]);
            val[sz] = 0;
            nx = sz;
        }
        p = nx;
    }
    val[p] = id;
    sid[string(s)] = id;
}

void getfail(){
    queue<int> q;
    f[0] = 0;
    for (int c = 0; c < 26; ++c) {
        int u = tr[0][c];
        if(u) q.push(u), f[u] = 0, last[u] = 0;
    }
    while (!q.empty()){
        int u = q.front(); q.pop();
        for (int c = 0; c < 26; ++c) {
            int v = tr[u][c];
            if(!v) {tr[u][c] = tr[f[u]][c]; continue;}
            q.push(v);
            f[v] = tr[f[u]][c];
            last[v] = val[f[v]]? f[v]: last[f[v]];
        }
    }
}

void up(int u){
    if(u) cnt[val[u]]++, up(last[u]);
}

void find(char *t){
    int n = strlen(t);
    int p = 0;
    for (int i = 0; i < n; ++i) {
        int c = t[i]-'a';
        p = tr[p][c];
        if(val[p]) up(p);
        else if(last[p]) up(last[p]);
    }
}

void init(){
    sz = 0;
    clr(cnt), clr(tr[0]);
    sid.clear();
}

int main() {
    int n;
    while (scanf("%d", &n) == 1 && n){
        init();
        for (int i = 1; i <= n; ++i) {
            scanf("%s", P[i]);
            add(P[i], i);
        }
        getfail();
        char t[MT]; scanf("%s", t);
        find(t);
        int ans = -1;
        for (int i = 1; i <= n; ++i) {
            ans = max(ans, cnt[i]);
        }
        printf("%d\n", ans);
        for (int i = 1; i <= n ; ++i) {
            if(cnt[sid[string(P[i])]]==ans) printf("%s\n", P[i]);
        }
    }
    return 0;
}